﻿Imports System.Windows.Forms
Namespace Dialogs

    ''' <summary>Encapsulates the dbiWSFDayViewPrintSettings control and applies the settings to the provided dbiDayView.</summary>
    Public Class dlgDayViewPrintSettings
        Private l_DayView As Dbi.WinControl.DayView.dbiDayView
        Private l_PrintSettings As System.Drawing.Printing.PrinterSettings

        ''' <summary>Initializes the dbiWSFDayViewPrinterDialog</summary>
        Public Sub New(ByRef curDayView As Dbi.WinControl.DayView.dbiDayView, ByRef curPrinterSettings As System.Drawing.Printing.PrinterSettings)
            InitializeComponent()
            l_DayView = curDayView
            l_PrintSettings = curPrinterSettings
            Me.DbiDayViewPrintSettings1.LoadSettingsFromDayView(curDayView, curPrinterSettings)

        End Sub

        ''' <summary>Applies the settings to the dbiDayView and returns the System.Windows.Forms.DialogResult.OK</summary>
        Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
            Me.DbiDayViewPrintSettings1.ApplySettingsToDayView(l_DayView, l_PrintSettings)
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
            Me.Close()
        End Sub

        ''' <summary>Does not apply the settings to the dbiDayView and returns the System.Windows.Forms.DialogResult.Cancel</summary>
        Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
            Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
            Me.Close()
        End Sub
    End Class
End Namespace

